﻿using System;
using System.ComponentModel;
using System.Diagnostics;
using System.Drawing;
using System.IO;
using System.Text;
using System.Windows.Forms;
using HslCommunication.BasicFramework;
using HslCommunication.Controls;

namespace HslCommunication.LogNet
{
	/// <summary>
	/// 日志查看器的窗口类，用于分析统计日志数据
	/// </summary>
	// Token: 0x020000E7 RID: 231
	public partial class FormLogNetView : Form
	{
		/// <summary>
		/// 实例化一个日志查看器的窗口
		/// </summary>
		// Token: 0x06001175 RID: 4469 RVA: 0x00063CE0 File Offset: 0x00061EE0
		public FormLogNetView()
		{
			this.InitializeComponent();
		}

		// Token: 0x06001176 RID: 4470 RVA: 0x00009AA1 File Offset: 0x00007CA1
		private void FormLogNetView_Load(object sender, EventArgs e)
		{
		}

		// Token: 0x06001177 RID: 4471 RVA: 0x00063CF8 File Offset: 0x00061EF8
		private void userButton1_Click(object sender, EventArgs e)
		{
			using (OpenFileDialog openFileDialog = new OpenFileDialog())
			{
				openFileDialog.Filter = "日志文件(*.txt)|*.txt";
				bool flag = openFileDialog.ShowDialog() == DialogResult.OK;
				if (flag)
				{
					this.textBox1.Text = openFileDialog.FileName;
					this.DealWithFileName(openFileDialog.FileName);
				}
			}
		}

		// Token: 0x06001178 RID: 4472 RVA: 0x00063D68 File Offset: 0x00061F68
		private void DealWithFileName(string fileName)
		{
			bool flag = string.IsNullOrEmpty(fileName);
			if (!flag)
			{
				bool flag2 = !File.Exists(fileName);
				if (flag2)
				{
					MessageBox.Show("文件不存在！");
				}
				else
				{
					try
					{
						using (StreamReader streamReader = new StreamReader(fileName, Encoding.UTF8))
						{
							try
							{
								this.logNetAnalysisControl1.SetLogNetSource(streamReader.ReadToEnd());
							}
							catch (Exception ex)
							{
								SoftBasic.ShowExceptionMessage(ex);
							}
						}
					}
					catch (Exception ex2)
					{
						SoftBasic.ShowExceptionMessage(ex2);
					}
				}
			}
		}

		// Token: 0x06001179 RID: 4473 RVA: 0x00009AA1 File Offset: 0x00007CA1
		private void logNetAnalysisControl1_Load(object sender, EventArgs e)
		{
		}

		// Token: 0x0600117A RID: 4474 RVA: 0x00063E18 File Offset: 0x00062018
		private void toolStripStatusLabel2_Click(object sender, EventArgs e)
		{
			try
			{
				Process.Start("explorer.exe", "https://github.com/dathlin/C-S-");
			}
			catch
			{
			}
		}

		// Token: 0x0600117B RID: 4475 RVA: 0x00009AA1 File Offset: 0x00007CA1
		private void textBox1_KeyDown(object sender, KeyEventArgs e)
		{
		}
	}
}
